<?php $this->load->module('mobile/index/header', $common);?>
<div class="content">

        <form action="" class="listForm" method="post">
            <article class="bottom_c" id="payInfo">
                <section style="position: relative;">
                    <span class="password fl" style="width:4em">手机</span>
                    <span class="fRight fl">
                        <input name="Form[account]" placeholder="请输入手机号码" type="text">
                    </span>
                </section>
                <section class="gray_b">
                    <span class="password fl" style="width:4em">验证码</span>
                    <span class="fRight fl">
                        <span class="fr-send"><a class="getzym"  id="sendVadecode" href="javascript:void(0);" style="">发送验证码</a></span>
                        <span class="fl-send"><input type="text" maxlength="6" name="Form[code]" id="phoneyzm" placeholder="请输入验证码" value=""></span>
                    </span>
                </section>
                <section style="position: relative;">
                    <span class="password fl" style="width:4em">新密码</span>
                    <span class="fRight fl">
                        <input name="Form[password]" placeholder="请输入新密码" type="text" value="">
                    </span>
                </section>
                <section style="position: relative;" class="b_noneborder">
                    <span class="password fl" style="width:4em">确认密码</span>
                    <span class="fRight fl">
                        <input name="Form[repassword]" placeholder="请输入确认密码" type="text" value="">
                    </span>
                </section>
            </article>
            <div class="col_div">
                <a href="javascript:void(0);" class="btn btn-blue" title="找回密码">找回密码</a>
            </div>
        </form>
</div>

<?php $this->load->module('mobile/index/footer', $common);?>
<script type="text/javascript">
    function alert_popup(text){
        $.dialog({
            style:'tip',
            width:200,
            closeTime:500,
            content: '<p style="text-align: center">'+text+'</p>'
        }).open();
    }

    var wait=60;
    function time() {
        var o = $('#sendVadecode');
        if (wait == 0) {
            o.addClass("getzym");
            o.html("发送验证码");
            wait = 60;
        } else {

            o.addClass("getzym unable");
            o.html("重新发送(" + wait + ")");
            wait--;
            setTimeout(function() {
                    time()
                },
                1000)
        }
    }

    $(function(){

        $('#sendVadecode').click(function(){
            if (wait !== 60) {
                return false ;
            }
            if($('input[name="Form[account]"]').val().length == 0){
                alert_popup('请输入手机号');
                return false;
            }
            var account = $('input[name="Form[account]"]').val();
            var type = $(this).attr('type');
            $.post('<?php echo $vade_url ;?>',{
                account: account,
                type:type
            },function(data){
                if(data.status=='1')
                {
                    time();
                    return false;
                }
                alert_popup(data.info);
                return false;
            },'json')

        })

        $('.btn').click(function(){

            if($('input[name="Form[account]"]').val().length == 0){
                alert_popup('请输入手机号');
                return false;
            }
            if($('input[name="Form[code]"]').val().length == 0){
                alert_popup('请输入验证码');
                return false;
            }
            if($('input[name="Form[password]"]').val().length == 0){
                alert_popup('请输入密码');
                return false;
            }
            if($('input[name="Form[repassword]"]').val().length == 0){
                alert_popup('请输入确认密码');
                return false;
            }
            if($('input[name="Form[repassword]"]').val() !== $('input[name="Form[password]"]').val()){
                alert_popup('两次密码不一致');
                return false;
            }

            var account = $('input[name="Form[account]"]').val();
            var password = $('input[name="Form[password]"]').val();
            var code = $('input[name="Form[code]"]').val();
            $.post('<?php echo $form_url ;?>',{
                account: account,
                password: password,
                code: code
            },function(data){
                if(data.status=='1')
                {
                    window.location.href = '<?php echo site_url('/mobile/index'); ?>' ;
                }
                alert_popup(data.info);
                return false;
            },'json')
        })
    });
</script>